/*
 * $Id: UiTask.java,v 1.5 2009/12/16 18:00:27 navdeep_mahajan Exp $
 *
 * Copyright (C) 2006 General Electric Company. All Rights Reserved.
 *
 * This software is the confidential and proprietary information of the General
 * Electric Company (GE). You shall not disclose this software and shall use it
 * only in accordance with the terms of the license agreement you entered into
 * with GE.
 *
 * GE MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
 * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
 * NON-INFRINGEMENT. GE SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE
 * AS A RESULT OF USING, MODIFYING, OR DISTRIBUTING THIS SOFTWARE OR ITS
 * DERIVATIVES.
 */

package com.ge.healthcare.autosc.ui.pojo;

import java.util.Date;

import com.ge.healthcare.autosc.common.ASCUtil;
import com.ge.healthcare.autosc.common.database.pojo.ActTask;
import com.ge.healthcare.autosc.common.database.pojo.CfgStepType;
import com.ge.healthcare.autosc.common.database.pojo.CfgTaskCategoryInfo;
import com.ge.healthcare.autosc.common.database.pojo.CfgTaskType;
import com.ge.healthcare.autosc.common.util.TimeFormatStandard;

public class UiTask extends AscUiObject{
	private Long taskId;
	private Long requestId;
	private Long parentId;
	private Long failedCount;
	private Long stepTypeId;
	private String taskType;
	private Character extAutosc;
	private Long priority;
	private String expireDate;
	private String retryUntil;
	private Long maxRetryCount;
	private Long taskCategoryId;
	private String taskCategory;
	private String stepType;
	private String serverName;
	public UiTask(ActTask actTask) {
		load(actTask);
	}
	public void load(ActTask task){
		setTaskId(task.getTaskId());
		setRequestId(task.getRequestId());
		setParentId(task.getParentId());
		setFailedCount(task.getFailedCount());
		setStepTypeId(task.getStepTypeId());
		setTaskType(task.getTaskType());
		setExtAutosc(task.getExtAutosc());
		setPriority(task.getPriority());
		setStartTime(task.getStartTime());
		setEndTime(task.getEndTime());
		setExpireDate(task.getExpireDate());
		setRetryUntil(task.getRetryUntil());
		setCodeId(task.getCodeId());
	}
	public void load(CfgTaskType tType) {
		setTaskType(tType.getTaskTypeName());
		setMaxRetryCount(tType.getMaxRetryCount());
	}

	public void load(CfgTaskCategoryInfo tCatInfo) {
		setTaskCategoryId(tCatInfo.getTaskCategoryId());
		setTaskCategory(tCatInfo.getTaskCategory());
	}
	public void load(CfgStepType stepType){
		setStepTypeId(stepType.getStepTypeId());
		setStepType(stepType.getStepType());
		setServerName(stepType.getServerName());
	}

	/**
	 * @return the taskId
	 */
	public java.lang.Long getTaskId() {
		return taskId;
	}

	/**
	 * @param taskId the taskId to set
	 */
	public void setTaskId(java.lang.Long taskId) {
		this.taskId = taskId;
	}

	/**
	 * @return the requestId
	 */
	public Long getRequestId() {
		return requestId;
	}

	/**
	 * @param requestId the requestId to set
	 */
	public void setRequestId(Long requestId) {
		this.requestId = requestId;
	}

	/**
	 * @return the parentId
	 */
	public Long getParentId() {
		return parentId;
	}

	/**
	 * @param parentId the parentId to set
	 */
	public void setParentId(Long parentId) {
		this.parentId = parentId;
	}

	/**
	 * @return the failedCount
	 */
	public Long getFailedCount() {
		return failedCount;
	}

	/**
	 * @param failedCount the failedCount to set
	 */
	public void setFailedCount(Long failedCount) {
		this.failedCount = failedCount;
	}

	/**
	 * @return the stepTypeId
	 */
	public Long getStepTypeId() {
		return stepTypeId;
	}

	/**
	 * @param stepTypeId the stepTypeId to set
	 */
	public void setStepTypeId(Long stepTypeId) {
		this.stepTypeId = stepTypeId;
	}

	/**
	 * @return the taskType
	 */
	public String getTaskType() {
		return taskType;
	}

	/**
	 * @param taskType the taskType to set
	 */
	public void setTaskType(String taskType) {
		this.taskType = taskType;
	}

	/**
	 * @return the extAutosc
	 */
	public Character getExtAutosc() {
		return extAutosc;
	}

	/**
	 * @param extAutosc the extAutosc to set
	 */
	public void setExtAutosc(Character extAutosc) {
		this.extAutosc = extAutosc;
	}

	/**
	 * @return the priority
	 */
	public Long getPriority() {
		return priority;
	}

	/**
	 * @param priority the priority to set
	 */
	public void setPriority(Long priority) {
		this.priority = priority;
	}

	/**
	 * @return the expireDate
	 */
	public String getExpireDate() {
		return expireDate;
	}

	/**
	 * @param expireDate the expireDate to set
	 */
	public void setExpireDate(String expireDate) {
		this.expireDate = expireDate;
	}

	public void setExpireDate(Date time) {
		if (!ASCUtil.isNullOrEmptyObject(time)) {
			this.expireDate = TimeFormatStandard.getDtInEndUserDisplayFormat(time);
		}
	}
	/**
	 * @return the retryUntil
	 */
	public String getRetryUntil() {
		return retryUntil;
	}

	/**
	 * @param retryUntil the retryUntil to set
	 */
	public void setRetryUntil(String retryUntil) {
		this.retryUntil = retryUntil;
	}
	public void setRetryUntil(Date time) {
		if (!ASCUtil.isNullOrEmptyObject(time)) {
			this.retryUntil = TimeFormatStandard.getDtInEndUserDisplayFormat(time);
		}
	}
	/**
	 * @return the maxRetryCount
	 */
	public Long getMaxRetryCount() {
		return maxRetryCount;
	}
	/**
	 * @param maxRetryCount the maxRetryCount to set
	 */
	public void setMaxRetryCount(Long maxRetryCount) {
		this.maxRetryCount = maxRetryCount;
	}
	/**
	 * @return the taskCategoryId
	 */
	public Long getTaskCategoryId() {
		return taskCategoryId;
	}
	/**
	 * @param taskCategoryId the taskCategoryId to set
	 */
	public void setTaskCategoryId(Long taskCategoryId) {
		this.taskCategoryId = taskCategoryId;
	}
	/**
	 * @return the taskCategory
	 */
	public String getTaskCategory() {
		return taskCategory;
	}
	/**
	 * @param taskCategory the taskCategory to set
	 */
	public void setTaskCategory(String taskCategory) {
		this.taskCategory = taskCategory;
	}
	/**
	 * @return the stepType
	 */
	public String getStepType() {
		return stepType;
	}
	/**
	 * @param stepType the stepType to set
	 */
	public void setStepType(String stepType) {
		this.stepType = stepType;
	}
	/**
	 * @return the serverName
	 */
	public String getServerName() {
		return serverName;
	}
	/**
	 * @param serverName the serverName to set
	 */
	public void setServerName(String serverName) {
		this.serverName = serverName;
	}
}
